/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package intopo.evogame.partnerselection.config;

import java.lang.reflect.InvocationTargetException;

/**
 * Thrown to indicate that a problem occurred while constructing a strategy.
 *
 * @author <a href="mailto:mariano.pedro@gmail.com">Pedro Mariano</a>
 *
 * @version 1.0 __DATE__
 */
public class ConstructStrategyException
	extends Exception
{
	/**
	 * The tag name that was found in the text file and that does not match any key in the associatative memory.
	 */
	final String tagName;

	public ConstructStrategyException (String tagName, InstantiationException e)
	{
		super (e);
		this.tagName = tagName;
	}
	public ConstructStrategyException (String tagName, IllegalAccessException e)
	{
		super (e);
		this.tagName = tagName;
	}
	public ConstructStrategyException (String tagName, IllegalArgumentException e)
	{
		super (e);
		this.tagName = tagName;
	}
	public ConstructStrategyException (String tagName, InvocationTargetException e)
	{
		super (e);
		this.tagName = tagName;
	}
	/**
	 * Get the tag name that was found in the text file and that does not match any key in the associatative memory.
	 * @return the tag name that was found in the text file.
	 */
	public String getTagName ()
	{
		return this.tagName;
	}
	public String getUserMessage ()
	{
		StringBuffer result = new StringBuffer (68 + 1024 + 14 + 2000);
		result.append ("Error creating an instance of a strategy of game.  Strategy tag is '");
		result.append (this.tagName);
		result.append ("\nCause was:\n");
		result.append (this.getCause ().getLocalizedMessage ());
		return result.toString ();
	}
}

// Local Variables:
// mode: java
// mode: flyspell-prog
// ispell-local-dictionary: "british"
// End:
